home *** CD-ROM | disk | FTP | other *** search
/ Champak 74 / Volume 74 My Disc - Damaged.iso / Games / shusher.swf / scripts / frame_40 / DoAction.as
Text File  |  2008-08-08  |  3KB  |  107 lines

  1. setupTheatre();
  2. noisyPeople = new Array();
  3. noiseCounter = 0;
  4. if(!lightsOn)
  5. {
  6.    attachMovie("flashlight","Flashlight",9000);
  7.    if(highBeam)
  8.    {
  9.       Flashlight.gotoAndStop(2);
  10.    }
  11. }
  12. satisfaction = 100;
  13. Interface.SatisMeter.gotoAndStop(100);
  14. minutesLeft = 59;
  15. secondsLeft = 59;
  16. Game.Player.moveSpeed = playerMoveSpeed;
  17. Game.Player.moveDir = null;
  18. Game.Player._x = playerStartX;
  19. Game.Player._y = playerStartY;
  20. Game.Player.gotoAndStop("down");
  21. playerBusy = false;
  22. Flashlight._x = playerStartX;
  23. Flashlight._y = playerStartY;
  24. var musicSelection = randInt(1,6);
  25. if(musicSelection <= 2)
  26. {
  27.    SFX.gotoAndPlay("StartMovie1");
  28. }
  29. else if(musicSelection >= 3 && musicSelection <= 4)
  30. {
  31.    SFX.gotoAndPlay("StartMovie2");
  32. }
  33. else if(musicSelection >= 5 && musicSelection <= 6)
  34. {
  35.    SFX.gotoAndPlay("StartMovie3");
  36. }
  37. Game.onEnterFrame = function()
  38. {
  39.    if(_root.gameInPlay)
  40.    {
  41.       _root.noiseCounter = _root.noiseCounter + 1;
  42.       if(_root.noiseCounter % _root.noiseFrequency == 0)
  43.       {
  44.          var _loc2_ = 1;
  45.          while(_loc2_ <= _root.noisesAtOnce)
  46.          {
  47.             if(_root.noisyPeople.length < _root.filledSeats)
  48.             {
  49.                unleashNoise();
  50.             }
  51.             _loc2_ = _loc2_ + 1;
  52.          }
  53.       }
  54.       _root.setTimerDigits(_root.minutesLeft,_root.secondsLeft,_root.Interface.GameTimer);
  55.       _root.satisfaction -= _root.noisyPeople.length * _root.satisDecrement;
  56.       if(_root.satisfaction <= 0)
  57.       {
  58.          _root.gotoAndPlay("GameOver");
  59.       }
  60.       var _loc3_ = _root.satisfaction - _root.Interface.SatisMeter._currentframe;
  61.       _root.Interface.SatisMeter.gotoAndStop(_root.Interface.SatisMeter._currentframe + Math.round(_loc3_ / 1.5));
  62.    }
  63. };
  64. Game.Player.onEnterFrame = function()
  65. {
  66.    if(_root.gameInPlay)
  67.    {
  68.       this.currentRow = Math.ceil(this._y / tileHeight);
  69.       this.currentColumn = Math.ceil(this._x / tileWidth);
  70.       this.swapDepths((this.currentRow - 1) * 100 + this.currentColumn);
  71.       if(!playerBusy)
  72.       {
  73.          if(Key.isDown(38))
  74.          {
  75.             moveAvatar(this,"up");
  76.             this.Clip.gotoAndStop("Walk");
  77.          }
  78.          else if(Key.isDown(40))
  79.          {
  80.             moveAvatar(this,"down");
  81.             this.Clip.gotoAndStop("Walk");
  82.          }
  83.          else if(Key.isDown(37))
  84.          {
  85.             moveAvatar(this,"left");
  86.             this.Clip.gotoAndStop("Walk");
  87.          }
  88.          else if(Key.isDown(39))
  89.          {
  90.             moveAvatar(this,"right");
  91.             this.Clip.gotoAndStop("Walk");
  92.          }
  93.          else
  94.          {
  95.             this.Clip.gotoAndStop("Stop");
  96.          }
  97.          if(Key.isDown(32))
  98.          {
  99.             shush();
  100.          }
  101.       }
  102.    }
  103. };
  104. timerCode = setInterval(decrementTimer,timerUnit);
  105. gameInPlay = true;
  106. stop();
  107.